home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d13 / qptech.arc / TI582.ASC < prev    next >
Text File  |  1991-04-25  |  16KB  |  595 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  9. VERSION  :  All
  10.      OS  :  DOS
  11.    DATE  :  March 28, 1991                 PAGE  :  1/8
  12.  
  13.   TITLE  :  Entering and Manipulating Date and Time Values
  14.  
  15.  
  16.  
  17.  
  18.              What is a Date?
  19.  
  20. In Quattro Pro, dates and times are stored as values rather than
  21. labels.  The date number represents the number of days between
  22. the current date and December 30, 1899.  December 30, 1899 is day
  23. zero, and each day after that has its own unique number.  This
  24. number is referred to as the Date Serial Number.  For example,
  25. the date serial number 33065 represents July 11, 1990 (i.e. the
  26. 33065th day since December 30, 1899).
  27.  
  28. These date serial numbers allow Quattro Pro to perform
  29. mathematical calculations on dates and times.  Labels, on the
  30. other hand, always have a value of zero, and therefore cannot
  31. easily be used in time calculations.
  32.  
  33. Time is stored as a fraction of a day, and is always a value
  34. between zero and one.  This number is commonly referred to as the
  35. Time Serial Number.  For example, 0.00 is 12:00 AM, 0.25 is 6:00
  36. AM, 0.75 is 6:00 PM, 0.324 is 7:46:34 AM, and 0.689 is 4:32:10
  37. PM.
  38.  
  39. The date and time serial numbers can be stored in a single cell
  40. (i.e. the @NOW function), or individual cells (i.e the @TODAY
  41. function).  The date serial number and time serial number can be
  42. combined in the same cell by adding them together.  For example,
  43. 33065.893345 represents the combined date/time serial number for
  44. July 11, 1990 at 9:26:25 PM.
  45.  
  46.             Formatting a Cell
  47.  
  48. The display of a cell can be different from what is actually
  49. stored in the cell.  The display is called the format of a cell.
  50. For example, the contents of a cell may be the date serial number
  51. 33065, but onscreen, the cell may display "11-Jul-90".    A cell
  52. can be formatted for a date or time by selecting /Style|Numeric
  53. Format|Date (or Date|Time), or by executing the CTRL-D shortcut
  54. key combination, which automatically formats your entry as a
  55. valid date.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  75. VERSION  :  All
  76.      OS  :  DOS
  77.    DATE  :  March 28, 1991                 PAGE  :  2/8
  78.  
  79.   TITLE  : Entering and Manipulating Date and Time Values
  80.  
  81.  
  82.  
  83.  
  84.      VALID DATE FORMAT                  EXAMPLE
  85. -----------------------------------------------------------------
  86.      (DD-MMM-YY)                  11-JUL-90
  87.      (DD-MMM)                      11-JUL
  88.      (MMM-YY)                      JUL-90
  89.      (Long Int'l) {Default is (MM/DD/YY)}      07/11/90
  90.      (Short Int'l) {Default is (MM/DD)}           07/11
  91.  
  92. The default cell display format is determined by the keystrokes
  93. used to enter the data, such as the CTRL-D, or by the /Options|
  94. International|Date (or Time) settings.    /Options|International
  95. sets the global display options for all spreadsheets, and sets
  96. the sequence of arguments for entering dates.  For example,
  97. DD/MM/YY format can be set as the default, so that July 11, 1990
  98. is entered (and displayed) as 11/07/90 instead of 7/11/90.
  99. Changing this option does not effect any cells specifically
  100. formatted with /Style|Numeric Format.
  101.  
  102. When using a combined date/time serial number, a cell can be
  103. formatted for either a date or a time, but not both.
  104.  
  105.           Entering Date and Time Values
  106.  
  107. There are four methods for entering date and time values:
  108.  
  109.    1.  @Functions
  110.  
  111.    2.  CTRL-D
  112.  
  113.    3.  /Database|Data Entry
  114.  
  115.    4.  Manually entering actual date/time serial number value.
  116.  
  117.              Using @functions
  118.  
  119. There are several @functions you can use to enter dates and
  120. times.    @DATE accepts three parameters and converts them into a
  121. date serial number.  Likewise, @TIME converts three parameters
  122. into a time serial number.  @DATEVALUE and @TIMEVALUE convert
  123. text strings that are in a valid date format and time format into
  124. date serial numbers and time serial numbers, respectively.
  125. @TODAY looks at the computer's internal clock and inserts the
  126. current date serial number.  @NOW goes one step further and
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  141. VERSION  :  All
  142.      OS  :  DOS
  143.    DATE  :  March 28, 1991                 PAGE  :  3/8
  144.  
  145.   TITLE  : Entering and Manipulating Date and Time Values
  146.  
  147.  
  148.  
  149.  
  150. inserts the current date/time serial number.  Since @TODAY and
  151. @NOW take information from the system clock, they are
  152. recalculated each time a spreadsheet is loaded, or the F9 (CALC)
  153. key is pressed.  The examples in the following table are for the
  154. time of 9:26:25 PM on July 11, 1990:
  155.  
  156. FUNCTION    CONVERT FROM    CONVERT TO           EXAMPLE
  157. ----------------------------------------------------------------------------
  158.  
  159. @NOW        Computer Clock  Date/Time Serial Number
  160.                            @NOW = 33065.89335
  161. @TODAY        Computer Clock  Date Serial Number @TODAY = 33065
  162. @DATE        YR,MO,DAY        Date Serial Number @DATE(90,7,11) = 33065
  163. @TIME        HR,MIN,SEC        Time Serial Number @TIME(21,26,25) = 0.89335
  164. @DATEVALUE  Date String     Date Serial Number @DATEVALUE("11-Jul-90") =
  165. 33065
  166. @TIMEVALUE  Time String     Time Serial Number @TIMEVALUE("9:26:25PM") =
  167. 0.89335
  168.  
  169.           Using the CTRL-D shortcut key
  170.  
  171. The CTRL-D shortcut key lets you enter a date in a valid date
  172. format.  Quattro Pro automatically places the appropriate date
  173. serial number in the cell and formats it to display as a date.
  174.  
  175. Similarly, CTRL-D preceding a time format of HH:MM:SS where hours
  176. are in military time or HH:MM:SS(AM or PM) with hours in standard
  177. time places the time serial number in the cell and formats the
  178. cell to display as a time.  For example, after pressing CTRL-D
  179. and entering 7/11/90.  The screen shows 7/11/90 and the date
  180. serial number 33065 shows on the edit line as the actual contents
  181. of the cell.
  182.  
  183.           Using the /Database|Data Entry command
  184.  
  185. The best way to enter a large number of dates and/or times is to
  186. use /Database|Data Entry|Dates Only.  This lets you select an
  187. area where dates (or times) are the only data that can be
  188. entered.  If a cell has been formatted for Dates Only, you don't
  189. have to precede your entries with CTRL-D.  The edit line displays
  190. DATE, only valid date entries are allowed, and the date/time
  191. serial number does not show on the edit line or in the cell.
  192. This also makes it easier to edit the date/time.  For example, if
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  207. VERSION  :  All
  208.      OS  :  DOS
  209.    DATE  :  March 28, 1991                 PAGE  :  4/8
  210.  
  211.   TITLE  : Entering and Manipulating Date and Time Values
  212.  
  213.  
  214.  
  215.  
  216. a cell was formatted with /Database|Data Entry|Dates Only,
  217. entering 7/11/90 shows just that in the cell.  The edit line also
  218. shows 7/11/90 preceded by the word DATE.  If 7-11-90 was entered,
  219. the error message "Invalid date or time" will display because
  220. that is not a valid date format.
  221.  
  222.      Manually entering date/time serial number values
  223.  
  224. A date/time value can be entered just like any other number.  The
  225. cell can then be formatted to show the desired date and/or time
  226. format.  It is the date and time display formats that make these
  227. values different from any other number.  For example, if the
  228. number 33065 is entered, choosing /Style|Numeric Format|Date|Long
  229. Int'l makes the cell display 07/11/90.
  230.  
  231.        Manipulating date and/or time serial numbers
  232.  
  233. There are several @functions that are useful in evaluating a date
  234. and/or time serial number and retrieving information from it.
  235. For a date serial number, the @YEAR, @MONTH, and @DAY functions
  236. return the specific year, month, and day of that number.
  237. Likewise, the @HOUR, @MINUTE, and @SECOND functions return the
  238. hour, minute, and second information for a time serial number.
  239.  
  240. FUNCTION    CONVERT FROM       CONVERT TO       EXAMPLE
  241. ----------------------------------------------------------------------------
  242.  
  243. @DAY        Date Serial Number Day of Month       @DAY(33065) = 11
  244. @MONTH        Date Serial Number Month of Year       @MONTH(33065) = 7
  245. @YEAR        Date Serial Number Year of Century       @YEAR(33065) = 90
  246. @SECOND     Time Serial Number Second of Minute    @SECOND(0.89335) = 25
  247. @MINUTE     Time Serial Number Minute of Hour       @MINUTE(0.89335) = 26
  248. @HOUR        Time Serial Number Hour of Day       @HOUR(0.89335) = 21
  249.  
  250.  
  251.              Calculating elapsed time
  252.  
  253. To determine the elapsed time between starting and ending date or
  254. time values, subtract the start value from the end value.  The
  255. trick is converting this number into a useful form.  If the
  256. result is formatted as a date, it displays as a date late in the
  257. year 1899 because time is a fraction of a day.    Quattro Pro
  258. assumes the calculation is referring to day 1, which is December
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  273. VERSION  :  All
  274.      OS  :  DOS
  275.    DATE  :  March 28, 1991                 PAGE  :  5/8
  276.  
  277.   TITLE  : Entering and Manipulating Date and Time Values
  278.  
  279.  
  280.  
  281.  
  282. 30, 1899.  In most cases, the date and time serial number should
  283. be combined in the same cell when dealing with elapsed time.
  284. This will cover the case where the end value has passed midnight
  285. into the next day.  If the date and time are not combined and
  286. time values are entered, the difference of two cells displays as
  287. a negative number if the ending time has passed midnight, or an
  288. incorrect number if the difference has passed a 24-hour period.
  289.  
  290. For example, if a beginning time of 9:26:25 PM (which has the
  291. time serial number of 0.893345) and an ending time of 7:41:36 AM
  292. (which has the time serial number of 0.320556) are entered,
  293. subtracting the beginning time from the ending time will result
  294. in the number -0.572789 (which displays as 10:15:11 AM when
  295. formatted for time).  Obviously, this is not the correct answer.
  296. The problem is that the elapsed time has passed midnight.  Simply
  297. subtracting the two time values gives an incorrect (in this case
  298. negative) elapsed time.  The solution?    Combine the date serial
  299. number with the time serial number, creating a combined date/time
  300. serial number for both the beginning and ending times, before
  301. subtracting one from the other.
  302.  
  303. To correct the example above, assume the beginning time is
  304. 9:26:25 PM July 11, 1990 (date serial number 33065), and the
  305. ending time is 7:41:36 AM July 12, 1990 (date serial number
  306. 33066).  Combining the date and time serial number results in the
  307. beginning number 33065.893345 and the ending number 33066.320556.
  308. Subtracting the beginning number from the ending number gives the
  309. value 0.427211, which you can convert to hours, minutes, and
  310. seconds.
  311.  
  312. Three additional @functions that useful in calculating elapsed
  313. time: @INT, @MOD, and @ROUND.  @INT evaluates a real number
  314. (combined integer and decimal) and returns only the integer
  315. portion of that number.
  316.  
  317. Similar to the @INT function, @MOD is used to return the decimal
  318. portion of a real number.  Since @MOD divides the first argument
  319. ("X") by the second argument ("Y"), the second argument ("Y")
  320. should be set to 1 when doing elapsed time calculations.  If "Y"
  321. is not set to 1, the correct remainder will not returned.
  322.  
  323. @ROUND is used to change the accuracy of a number to the closest
  324. whole number.  For instance, in the following example, there is
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  339. VERSION  :  All
  340.      OS  :  DOS
  341.    DATE  :  March 28, 1991                 PAGE  :  6/8
  342.  
  343.   TITLE  : Entering and Manipulating Date and Time Values
  344.  
  345.  
  346.  
  347.  
  348. no need to deal with partial seconds, so we round the real number
  349. 10.94400014 to the next whole second, 11.
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  405. VERSION  :  All
  406.      OS  :  DOS
  407.    DATE  :  March 28, 1991                 PAGE  :  7/8
  408.  
  409.   TITLE  : Entering and Manipulating Date and Time Values
  410.  
  411.  
  412.  
  413.  
  414. FUNCTION       DESCRIPTION OF FUNCTION           EXAMPLE
  415. -----------------------------------------------------------------
  416.  
  417. @INT(X)        Drops Fraction of X, Returning Integer Value
  418.                            @INT(5.35) = 5
  419. @MOD(X,Y)      Divides X Value by Y and Returns Remainder Value
  420.                            @MOD(5.35,1) = 0.35
  421. @ROUND(X,NUM)  Adjusts Precision of X to NUM Decimal Points
  422.                            @ROUND(5.35,1) = 5.4
  423.  
  424. The following example shows how to calculate the number of days
  425. and hours between a beginning and ending date and time.  The
  426. concept here is to:
  427.  
  428.    1.  Input two date/time values.
  429.  
  430.    2.  Calculate the difference between the values giving elapsed
  431.        time.
  432.  
  433.    3.  Separate the integer and decimal portions of the elapsed
  434.        time.
  435.  
  436.    4.  Convert the decimal portion into a different measure (i.e.
  437.        hours to minutes).
  438.  
  439.    5.  Repeat steps 3 & 4 until the desired precision is reached.
  440.  
  441. Cells A2 and B2 are used as input date cells in this example.
  442.  
  443. Enter the following information into the cells indicated (The
  444. semicolons and the descriptions following them can be omitted):
  445.  
  446. A1: 'Begin
  447. B1: 'End
  448. C1: 'Elapsed
  449. D1: 'Days
  450. E1: 'Part Days
  451. F1: 'Part Day(Hr)     ;Partial days measured in hours
  452. A2: 33065.89335
  453. B2: 33070.32056
  454. C2: +B2-A2         ;The difference between the two times
  455. D2: @INT(C2)         ;Integer portion of elapsed time returns days
  456. E2: @MOD(C2,1)         ;Remainder portion returns partial days
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  471. VERSION  :  All
  472.      OS  :  DOS
  473.    DATE  :  March 28, 1991                 PAGE  :  8/8
  474.  
  475.   TITLE  : Entering and Manipulating Date and Time Values
  476.  
  477.  
  478.  
  479.  
  480. F2: +E2*24         ;Converts the remainder from days to hours
  481.  
  482.    1.  Set columns A through F to a column width of 12 using
  483.        /Style|Block Widths|Set Width|A1..F1|12.
  484.  
  485.    2.  Use /Style|Alignment|Center|A1..F2 to center the labels
  486.        and numbers.
  487.  
  488.    3.  Format cells A2 and B2 to a time format using
  489.        /Style|Numeric Format|Date|Time.
  490.  
  491. Note that cells A2 and B2 each contain a combined date/time
  492. serial number formatted for time, and thus do not indicate the
  493. date onscreen.    Remember, a cell cannot be formatted for both a
  494. date and a time.
  495.  
  496. Here is how the example looks for the two values entered:
  497.  
  498.    Begin   │    End    │ Elapsed │  Days  │ Part Days │Part Day(Hr)
  499. ───────────┼───────────┼─────────┼────────┼───────────┼─────────────
  500. 09:26:25 PM│07:41:36 AM│ 4.42721 │   4      │  0.42721  │  10.25304
  501.  
  502. The same concept can be used to calculate the hours, minutes and
  503. seconds elapsed.  The following is an addition to the above
  504. example, adding hours, minutes, and seconds.
  505.  
  506. G1: 'Hours
  507. H1: 'Part Hrs
  508. I1: 'Part Hrs(Min)     ;Partial hours measured in minutes
  509. J1: 'Minutes
  510. K1: 'Part Mins
  511. L1: 'Part Min(Sec)     ;Partial minutes measured in seconds
  512. M1: 'Seconds
  513. G2: @INT(F2)         ;Integer portion returns whole hours
  514. H2: @MOD(F2,1)         ;Remainder portion returns partial hours
  515. I2: +H2*60         ;Converts decimal from hours to minutes
  516. J2: @INT(I2)         ;Integer portion returns whole minutes
  517. K2: @MOD(I2,1)         ;Remainder portion returns partial minutes
  518. L2: +K2*60         ;Converts decimal from minutes to seconds
  519. M2: @ROUND(L2,0)     ;Rounds decimal to whole seconds
  520.  
  521.    1.  Set columns G through M to a column width of 12 using
  522.        /Style|Block Widths|Set Width|G1..M1|12.
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536. PRODUCT  :  Quattro Pro                            NUMBER  :  582
  537. VERSION  :  All
  538.      OS  :  DOS
  539.    DATE  :  March 28, 1991                 PAGE  :  9/8
  540.  
  541.   TITLE  : Entering and Manipulating Date and Time Values
  542.  
  543.  
  544.  
  545.  
  546.    2.  Use /Style|Alignment|Center|G1..M2 to center the labels
  547.        and numbers.
  548.  
  549.    3.  Use /Style|Hide Columns to hide columns C, E, F, H, I, K,
  550.        and L.
  551.  
  552. The hidden column option suppresses the screen display and
  553. printing of intermediate steps, which may clutter the ending
  554. results.  The spreadsheet will look like the following:
  555.  
  556.    Begin   │    End    │   Days   │  Hours   │ Minutes    │ Seconds
  557. ───────────┼───────────┼──────────┼──────────┼──────────┼─────────
  558. 09:26:25 PM│07:41:36 AM│    4      │    10    │      15    │    11
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.